﻿@{
    Layout = "~/_SiteLayout.cshtml";

    Business.Platform.WorkGroup bwg = new Business.Platform.WorkGroup();
    string name = string.Empty;
    string members = string.Empty;
    string note = string.Empty;
    Validation.RequireFields("name", "members");
    if (IsPost && Validation.IsValid())
    {
        name = Request.Form["Name"];
        members = Request.Form["Members"];
        note = Request.Form["Note"];

        Data.Model.WorkGroup wg = new Data.Model.WorkGroup();
        wg.ID = Guid.NewGuid();
        wg.Name = name.Trim();
        wg.Members = members;
        if (!note.IsNullOrEmpty())
        {
            wg.Note = note;
        }
        bwg.Add(wg);
        string query = Request.Url.Query;
        Business.Platform.Log.Add("添加了工作组", wg.Serialize(), Business.Platform.Log.Types.组织机构);
        
        <script type="text/javascript">
            parent.frames[0].treecng("1");
            alert('添加成功!');
            window.location = 'WorkGroup' + '@query';
        </script>
    }
} 
    <script type="text/javascript">
    var win = new RoadUI.Window();
    var validate = new RoadUI.Validate();
    </script>
    <form action="" method="post">
    <br />
    <table cellpadding="0" cellspacing="1" border="0" width="95%" class="formtable">
        <tr>
            <th style="width:80px;">名称：</th>
            <td><input type="text" id="Name" name="Name" class="mytext" validate="empty,minmax" value="" max="100" style="width:75%" /></td>
        </tr>
        <tr>
            <th style="width:80px;">成员：</th>
            <td><input type="text" id="Members" name="Members" class="mymember" validate="empty" value="" style="width:65%" /></td>
        </tr>
        <tr>
            <th style="width:80px;">备注：</th>
            <td><textarea id="Note" name="Note" class="mytext" style="width:90%; height:50px;"></textarea></td>
        </tr>
    </table>
    <div style="width:95%; margin:10px auto 10px auto; text-align:center;">
        <input type="submit" class="mybutton" onclick="return validate.validateForm(document.forms[0]);" name="Save" value="保存" />
    </div>
    </form>